<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/includes/main.jsp"%>

<form id="pagerForm" action="tripOrderList.action">
	<input type="hidden" name="pageInfo.currentPage" value="${pageInfo.currentPage}" />
	<input type="hidden" name="pageInfo.sorterName" value="${pageInfo.sorterName}" />
	<input type="hidden" name="pageInfo.sorterDirection" value="${pageInfo.sorterDirection}" />
	<input type="hidden" name="lookup" value="${lookup}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" method="post" action="tripOrderList.action?lookup=${lookup}" onsubmit="return dwzSearch(this, '${targetType}');">
	<input type="hidden" name="pageInfo.pageSize" value="${pageInfo.pageSize}" />
	<div class="searchBar">
		<ul class="searchContent">	
			<li>
				<label><hi:text key="开班日期" entity="TripOrder"/>:</label>
				<input type="text" name="pageInfo.trip.f_trip_date" class="date" readonly="readonly" value="<fmt:formatDate value='${pageInfo.trip.f_trip_date}' pattern='yyyy-MM-dd'/>" />
			</li>	  
			<li>
				<label><hi:text key="线路名称" entity="TripOrder"/>:</label>
				<input type="text" name="pageInfo.trip.trip_model.f_trip_name" value="${pageInfo.trip.trip_model.f_trip_name}"/>
			</li>	  
			<li>
				<label><hi:text key="订单来源" entity="TripOrder"/>:</label>
				<hi:search name="pageInfo.f_order_type" emu="orderType"/>
			</li>	  
			<li>
				<label><hi:text key="订单状态" entity="TripOrder"/>:</label>
				<hi:search name="pageInfo.f_order_status" emu="orderStatus"/>
			</li>	  
			<li class="dateRange">
				<label><hi:text key="下单时间" entity="TripOrder"/>:</label>
				<input type="text" name="pageInfo.f_order_date" class="date" readonly="readonly" value="<fmt:formatDate value='${pageInfo.f_order_date}' pattern='yyyy-MM-dd'/>"/>
				<input type="hidden" name="pageInfo.f_order_date_op" value="&gt;="><span class="limit">-</span>
				<input type="text" name="pageInfo.f_order_date01" class="date" readonly="readonly" value="<fmt:formatDate value='${pageInfo.f_order_date01}' pattern='yyyy-MM-dd'/>"/>
				<input type="hidden" name="pageInfo.f_order_date01_op" value="&lt;=">
			</li>	  
			<li>
				<label><hi:text key="下单人" entity="TripOrder"/>:</label>
				<input type="text" name="pageInfo.customer.f_fullName" value="${pageInfo.customer.f_fullName}"/>
			</li>	  
			<li>
				<label><hi:text key="联系人" entity="TripOrder"/>:</label>
				<input type="text" name="pageInfo.f_contact" value="${pageInfo.f_contact}"/>
			</li>	  
			<li>

			</li>	  
		</ul>
		<div class="subBar">
			<div class="buttonActive"><div class="buttonContent"><button type="submit"><hi:text key="查询"/></button></div></div>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		<c:choose>
			<c:when test="${empty lookup}">
				<authz:authorize ifAnyGranted="TRIPORDER_DEL"><li><a class="delete" href="<hi:url>tripOrderRemoveAll.action?ajax=1</hi:url>" target="removeSelected" title="<hi:text key="确实要删除这些记录吗?"/>"><span><hi:text key="批量删除"/></span></a></li></authz:authorize>
			</c:when>
			<c:otherwise>
				<li><a class="icon" href="javascript:$.bringBack({id:'-1', trip_date:'',trip_name:'',order_number:'',amount:'',order_type:'',order_status:'',order_date:'',fullName:'',numberOfPassagers:'',contact:'',contactPostCode:''})"><span><hi:text key="重置"/></span></a></li>
			</c:otherwise>
		</c:choose>			
		</ul>
	</div>
	<table class="table" width="100%" layoutH="138" targetType="${targetType}">
		<thead>
			<tr>
				<c:if test="${empty lookup}">
				<th width="22"><input type="checkbox" group="orderIndexs" class="checkboxCtrl"></th>
				</c:if>
				<th orderField="trip.trip_date" class="${pageInfo.sorterName eq 'trip.trip_date' ? pageInfo.sorterDirection : ''}"><hi:text key="开班日期" entity="TripOrder"/></th>
				<th orderField="trip.trip_name" class="${pageInfo.sorterName eq 'trip.trip_name' ? pageInfo.sorterDirection : ''}"><hi:text key="线路名称" entity="TripOrder"/></th>
				<th orderField="order_number" class="${pageInfo.sorterName eq 'order_number' ? pageInfo.sorterDirection : ''}"><hi:text key="订单号" entity="TripOrder"/></th>
				<th orderField="amount" class="${pageInfo.sorterName eq 'amount' ? pageInfo.sorterDirection : ''}"><hi:text key="订单金额" entity="TripOrder"/></th>
				<th orderField="order_type" class="${pageInfo.sorterName eq 'order_type' ? pageInfo.sorterDirection : ''}"><hi:text key="订单来源" entity="TripOrder"/></th>
				<th orderField="order_status" class="${pageInfo.sorterName eq 'order_status' ? pageInfo.sorterDirection : ''}"><hi:text key="订单状态" entity="TripOrder"/></th>
				<th orderField="order_date" class="${pageInfo.sorterName eq 'order_date' ? pageInfo.sorterDirection : ''}"><hi:text key="下单时间" entity="TripOrder"/></th>
				<th orderField="customer.fullName" class="${pageInfo.sorterName eq 'customer.fullName' ? pageInfo.sorterDirection : ''}"><hi:text key="下单人" entity="TripOrder"/></th>
				<th orderField="numberOfPassagers" class="${pageInfo.sorterName eq 'numberOfPassagers' ? pageInfo.sorterDirection : ''}"><hi:text key="预订人数" entity="TripOrder"/></th>
				<th orderField="contact" class="${pageInfo.sorterName eq 'contact' ? pageInfo.sorterDirection : ''}"><hi:text key="联系人" entity="TripOrder"/></th>
				<th orderField="contactCellPhone" class="${pageInfo.sorterName eq 'contactCellPhone' ? pageInfo.sorterDirection : ''}"><hi:text key="联系人手机" entity="TripOrder"/></th>
				<th width="90">
					<c:choose>
						<c:when test="${empty lookup}"><hi:text key="操作"/></c:when>
						<c:otherwise><hi:text key="查找带回"/></c:otherwise>
					</c:choose>
				</th>
			</tr>
		</thead>				
		<tbody>
			<c:forEach var="item" items="${tripOrders}" varStatus="s">
			<tr>
				<c:if test="${empty lookup}">
				<td><input name="orderIndexs" value="${item.id}" type="checkbox"></td>
				</c:if>			
				    <td>
					${item.trip.trip_date}
					</td>
				    <td><authz:authorize ifAnyGranted="TRIP_VIEW"><a href="<hi:url>tripView.action?trip.id=${item.trip.id}&workflow=-1</hi:url>" target="dialog"></authz:authorize>
				    ${item.trip.trip_model.trip_name}
				    <authz:authorize ifAnyGranted="TRIP_VIEW"></a></authz:authorize>
					</td>
				    <td>${item.order_number}</td>
				    <td>${item.amount}</td>
				    <td><hi:select emu="orderType" name="tripOrders[${s.index}].order_type" isLabel="true"/></td>
				    <td><hi:select emu="orderStatus" name="tripOrders[${s.index}].order_status" isLabel="true"/></td>
					<td><fmt:formatDate value="${item.order_date}" pattern="yyyy-MM-dd HH:mm"/></td>
				    <td><authz:authorize ifAnyGranted="HIUSER_VIEW"><a href="<hi:url>hiUserView.action?hiUser.id=${item.customer.id}&workflow=-1</hi:url>" target="dialog"></authz:authorize>
					${item.customer.fullName}
					<authz:authorize ifAnyGranted="HIUSER_VIEW"></a></authz:authorize>
					</td>
				    <td>${item.numberOfPassagers}</td>
				    <td>${item.contact}</td>
				    <td>${item.contactCellPhone}</td>
				<td>
				<c:choose>
					<c:when test="${empty lookup}">
				    <authz:authorize ifAnyGranted="TRIPORDER_DEL">
				      <a class="btnDel" href="<hi:url>tripOrderRemove.action?ajax=1&tripOrder.id=${item.id}</hi:url>" target="navTabTodo" title="<hi:text key="删除" parameterLanguageKeys="旅游订单"/>"><hi:text key="删除"/></a>
				    </authz:authorize>
				    <authz:authorize ifAnyGranted="TRIPORDER_VIEW">
				      <a class="btnView" href="<hi:url>tripOrderView.action?tripOrder.id=${item.id}</hi:url>" target="navTab" rel="tripOrder" title="<hi:text key="查看" parameterLanguageKeys="旅游订单"/>"><hi:text key="查看"/></a>
				    </authz:authorize>
				    <authz:authorize ifAnyGranted="TRIPORDER_SAVE">
				      <a class="btnEdit" href="<hi:url>tripOrderEdit.action?tripOrder.id=${item.id}</hi:url>" target="navTab" rel="tripOrder" title="<hi:text key="编辑" parameterLanguageKeys="旅游订单"/>"><hi:text key="编辑"/></a>
				    </authz:authorize>
					</c:when>
					<c:otherwise>
						<a class="btnSelect" href="javascript:$.bringBack({id:'${item.id}', trip_date:'${item.trip.trip_date}',trip_name:'${item.trip.trip_name}',order_number:'${item.order_number}',amount:'${item.amount}',order_type:'<hi:select emu="orderType" name="tripOrders[${s.index}].order_type" isLabel="true"/>',order_status:'<hi:select emu="orderStatus" name="tripOrders[${s.index}].order_status" isLabel="true"/>',order_date:'${item.order_date}',fullName:'${item.customer.fullName}',numberOfPassagers:'${item.numberOfPassagers}',contact:'${item.contact}',contactPostCode:'${item.contactPostCode}'})" title="<hi:text key="查找带回"/>"><hi:text key="选择"/></a>
					</c:otherwise>
				</c:choose>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>	
	<div class="panelBar">
		<div class="pages">
			<span><hi:text key="每页"/></span>
			<c:set var="pageSizeList" value="${fn:split('10|20|50|100', '|')}"/>  
			<select name="pageInfo.pageSize" onchange="dwzPageBreak({targetType:'${targetType}', numPerPage:this.value})">
				<c:forEach var="item" items="${pageSizeList}">
				<option value="${item}" ${item eq pageInfo.pageSize ? 'selected="selected"' : ''}>${item}</option>
				</c:forEach>
			</select>
			<span><hi:text key="条"/>，<hi:text key="共"/>${pageInfo.totalRecords}<hi:text key="条"/></span>
		</div>
		<div class="pagination" targetType="${targetType}" totalCount="${pageInfo.totalRecords}" numPerPage="${pageInfo.pageSize}" pageNumShown="${pageInfo.middlePageNum*2}" currentPage="${pageInfo.currentPage}"></div>
	</div>
</div>
